wayland: Try harder to be compatible
authorMatthias Clasen <mclasen@redhat.com>
Sun, 14 May 2023 23:14:58 +0000 (19:14 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 15 May 2023 04:20:24 +0000 (00:20 -0400)
We can keep the old unexport_handle api working
in the case that there is only a single exported
handle.

gdk/wayland/gdktoplevel-wayland.c

index efeb857b21930b0a20aefa99819c63f603fa6e43..efe9ef86cef79a8716e337b1ac0697a3be7497aa 100644 (file)
@@ -2557,6 +2557,20 @@ gdk_wayland_toplevel_export_handle (GdkToplevel                *toplevel,
 void
 gdk_wayland_toplevel_unexport_handle (GdkToplevel *toplevel)
 {
+  GdkWaylandToplevel *wayland_toplevel = GDK_WAYLAND_TOPLEVEL (toplevel);
+
+  if (wayland_toplevel->exported != NULL &&
+      wayland_toplevel->exported->next == NULL)
+    {
+      GdkWaylandExported *exported = wayland_toplevel->exported->data;
+
+      if (exported->handle)
+        {
+          gdk_toplevel_unexport_handle (toplevel, exported->handle);
+          return;
+        }
+    }
+
   g_warning ("Use gdk_wayland_toplevel_drop_exported_handle()");
 }